<%@ page import="domain.Contact,  domain.ContactGroup, domain.Address, domain.PhoneNumber "%>
<jsp:include page="topHtml.jsp" />
		<%
			Contact contact = (Contact) request.getAttribute("contact");
		    Object[] phones =  contact.getPhones().toArray(); 
			Object[] groups = (Object[])request.getAttribute("groups"); 
			Object[] contactGroups = contact.getGroups().toArray();
	    %>
		<form method="POST" action="ModifyContactServlet">
			<input type="hidden" name="id" size="25" value="<%=contact.getContactId()%>" />
			<label>First Name: </label>
			 <input type="text" name="firstName" size="25" value="<%=contact.getFirstName()%>">
				 <label>Last name: </label> <input type="text" name="lastName" size="30" value="<%=contact.getLastName()%>">
				 <label>Email: </label>
				 <input type="text" name="email" size="25" value="<%=contact.getEmail()%>"> <br>
				 <% Address addr = contact.getAdd(); %>
				 		<label for="street">Street:</label> <input type="text" name="street" size="25" value="<%= addr.getStreet() %>"> <br />
			<label for="zip">Zip:</label> <input type="text" name="zip" size="30" value="<%= addr.getZip() %>" /> <br />
			<label for="city">City: </label> <input type="text" name="city" size="25" value="<%= addr.getCity() %>" /> <br />
			<label for="country">Country: </label><input type="text" name="country" size="25" value="<%= addr.getCountry() %>" /> <br /> 
		  <% if ( phones.length == 0) {%>
	<span>This contact doesn't have any phones.</span>
	<% } else { %>
		<table style="border: solid;">
			<tr>
				<th>Phone kind</th>
				<th>Phone Number</th>
				<th>Actions</th>
			</tr>
			<% for( Object obj : phones) { %>
				<% PhoneNumber phone = (PhoneNumber) obj; %>
				<tr>
				<td><%= phone.getPhoneKind()%></td>
				<td><%= phone.getPhoneNumber()%></td>
				<td>
					<ul class="boite-controle">
						<li><a href="CreatePhoneServlet?contactId=<%= contact.getContactId() %>&phoneId=<%= phone.getPhoneId() %>" class="lien">Change phone number</a></li>
					</ul>
				</td>
			</tr>
			<% } %>
		</table>
		<% } %>
		<ul class="boite-controle">
				<li><a href="CreatePhoneServlet?contactId=<%= contact.getContactId() %>" class="lien">Add a phone number</a></li>
			</ul>
		  <br />
			<input type="checkbox" name="entreprise" />Society
			<label for="country">Siret Number: </label><input type="text" name="numSiret" size="25" />
			 <br /><br />
			<input class="button" type="submit" value="Submit" /><input
				class="button" type="reset" value="Reset">
		</form>
	
<jsp:include page="bottomHtml.jsp" />